
public class thread implements Runnable{
	private int startNum;
	private int endNum;
	private int count = 0;

	public thread(int startNum,int endNum) {
		this.startNum=startNum;
		this.endNum=endNum;
	}
	
	public void run() {
		for (int i = startNum; i < endNum; i++) {
			boolean flag=true;
			for(int j=2;j<i;j++){
				if(i%j==0){
				flag=false;
				break;
				}
			}
			if(flag){
				count++;
				}
		}
		System.out.println(startNum+"到"+endNum+ "数据区间的质数个数为:"+count);
	}
	
}
